﻿namespace area;

public class Triangle : Shape
{
    private float a;
    private float b;
    private float c;
    public float A
    {
        get { return a; }
        private set { this.a = value; }
    }
    public float B
    {
        get { return b; }        
        private set { this.b = value; }
    }
    public float C
    {
        get { return c; }
        private set { this.c = value; }
    }

    public Triangle(float a, float b, float c)
    {
        if (a + b > c && a - b < c && a > 0 && b > 0 && c > 0)
        {
            this.a = a;
            this.b = b;
            this.c = c;
            return;
        }
        Console.WriteLine("no!!");
    }

    public void sayType()
    {
        Console.WriteLine("Triangle");
    }

    public float getArea()
    {
        float p = (this.a + this.b + this.c)/2;
        double S = Math.Sqrt(p * (p - this.a) * (p - this.b) * (p - this.c));
        return (float)S;
    }
    
}